package com.irishud.hudnavi;

import android.app.Application;
import android.content.Context;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.wifi.WifiManager;

import com.irishud.hudnavi.ar_navi.ARHudComm;
import com.irishud.hudnavi.wifi.WifiReceiver;

public class NaviApp extends Application {
	public static String  deviceIMEI;
	private static NaviApp mNaviApp = null;
	private boolean isReconnect = false;
	//开始初始化Amap的消息定义
	private static final int OPEN_NAVI_PATCH = 0;
	//HUD断开重连的消息定义
	private static final int RECONNECT_HUD = 1;
	static public NaviApp getInstance()
	{
		return mNaviApp;
	}

	public void onCreate() {
		super.onCreate();
		mNaviApp = this;
		IntentFilter intentFilter = new IntentFilter();
		intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
        intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
		intentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
		registerReceiver(WifiReceiver.getInstance(),intentFilter);

		NaviAdapter.InitInstance();

		ARHudComm.getInstance().init(ARHudComm.CommMode.Device);
	}

	@Override
	public void onTerminate() {
		super.onTerminate();
		unregisterReceiver(WifiReceiver.getInstance());
	}

	public void connectService() {
	}

	public static class PackageUtil {
		static boolean checkPermission(Context context, String accessFineLocation) {
			int res = context.checkCallingOrSelfPermission(accessFineLocation);
			return (res == PackageManager.PERMISSION_GRANTED);
		}
	}

	//是否支持外置GPS的开关
	public static boolean isSupportExtGPS() {
		return false;
	}

	//是否单独调试外置GPS：支持HudNavi独立启动
	public static boolean isDebugExtGPS() {
		return false;
	}

	public static boolean isIndividual() {
		return false;
	}
}
